package 高级;

import java.util.Calendar;
import java.util.Date;
//1:一件商品生产日期是2017/7/12,保质期5年，算出失效日期
public class Zuoye04222 {
    public static void main(String[] args) {
        Calendar a = Calendar.getInstance();
        a.set(Calendar.YEAR ,2017);
        a.set(Calendar.MONTH,7);
        a.set(Calendar.DAY_OF_MONTH,12);
        System.out.println("商品的生产日期为"+a.get(Calendar.YEAR)+"年"+a.get(Calendar.MONTH)+"月"+a.get(Calendar.DAY_OF_MONTH)+"日");
        a.add(Calendar.YEAR,5);
        System.out.println("商品的过期日期为"+a.get(Calendar.YEAR)+"年"+a.get(Calendar.MONTH)+"月"+a.get(Calendar.DAY_OF_MONTH)+"日");

    }
}
